import request from '@/utils/request'

const API = {
    QUERY_RESOURCE_TYPE: '/resource/resource/type/query', // 查询资源类型
    QUERY_RESOURCE_CATEGORY: '/resource/resource/category/query/?typeId=',  // 查询资源分类  按类型Id
    QYERY_INFO_BY_TYPE: '/resource/resource/info/queryInfoByType',// 查询资源信息 返回值不带分类信息
    QUERY_INFO_BY_CATEGORY: '/resource/resource/info/queryByCategoryAndPrimaryKey', // 模糊搜索资源信息(根据分类)
    QUERY_INFO_BY_TYPE: '/resource/resource/info/queryByTypeAndPrimaryKey', // 模糊搜索资源信息(根据类型)
    QUERY_TREE: '/resource/resource/category/queryResourceTypeAndCategory', // 查询资源类型和类型下的分类，树结构
    QUERY_BY_ID: '/resource/resource/info/queryById?id=', // 查询资源信息（根据资源id）
    UPDATE_RESOURCE_INFO: '/resource/resource/info/update', // 修改资源信息
    ADD_RESOURCE_INFO: '/resource/resource/info/add', // 新增资源信息
    QUERY_PAGE: '/resource/resource/info/queryPage', // 分页查询资源信息
    ADD_RESOURCE_DOC:'/resource/resource/document/add', // 新增资源文档
    UPDATE_RESOURCE_DOC:'/resource/resource/document/update', // 更新资源文档
    QUERY_RESOURCE_DOC:'/resource/resource/document/getResourceDocument', // 获取资源文档
}

export const reqResourceType = () => request.get(API.QUERY_RESOURCE_TYPE)

export const reqResourceCategory = (typeId) => request.post(API.QUERY_RESOURCE_CATEGORY + typeId)

export const reqQueryInfoByType = (data) => request.post(API.QYERY_INFO_BY_TYPE, data)

export const reqQueryByType = (data) => request.post(API.QUERY_INFO_BY_TYPE, data)

export const reqQueryByCategory = (data) => request.post(API.QUERY_INFO_BY_CATEGORY, data)

export const reqQueryTree = () => request.get(API.QUERY_TREE)

export const queryById = (id) => request.post(API.QUERY_BY_ID + id)

export const reqAddResourceInfo = (data) => request.post(API.ADD_RESOURCE_INFO, data)

export const reqUpdateResourceInfo = (data) => request.put(API.UPDATE_RESOURCE_INFO, data)

export const reqQueryPage = (data) => request.post(API.QUERY_PAGE, data)

export const reqAddResourceDoc = (data) => request.post(API.ADD_RESOURCE_DOC, data)

export const reqUpdateResourceDoc = (data) => request.post(API.UPDATE_RESOURCE_DOC, data)

export const reqQueryResourceDoc = (data) => request.post(API.QUERY_RESOURCE_DOC, data)

